/**
 * Funciton Modules
 */
define([
	'jquery'
], function($) {
	// Define global function extends.
	(function (VAM) {
		VAM.fn = VAM.fn || {};
		VAM.fn.blank = function () {};
		VAM.fn.bind = function (func, scope) {
	    var xargs = arguments.length > 2 ? [].slice.call(arguments, 2) : null;
	    return function () {
	        var fn = $.isString(func) ? scope[func] : func,
	        args = (xargs) ? xargs.concat([].slice.call(arguments, 0)) : arguments;
	        return fn.apply(scope || fn, args);
	    };
		};

		$('body').ajaxError(function(e, jqxhr, settings, exception){
	    var targetUrl = jqxhr.responseText;
	    window.location = VAM.root + targetUrl;
		});
	})(VAM);
});